package com.hiultra.archive.controller;

import java.net.URISyntaxException;
import java.util.List;
import java.util.UUID;
import javax.servlet.http.HttpServletResponse;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.hiultra.archive.domain.ArchiveUploadTask;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hiultra.common.annotation.Log;
import com.hiultra.common.core.controller.BaseController;
import com.hiultra.common.core.domain.AjaxResult;
import com.hiultra.common.enums.BusinessType;
import com.hiultra.archive.domain.ArchiveBoxinnerMoveTask;
import com.hiultra.archive.service.IArchiveBoxinnerMoveTaskService;
import com.hiultra.common.utils.poi.ExcelUtil;
import com.hiultra.common.core.page.TableDataInfo;

/**
 * 盒间档案移位任务Controller
 *
 * @author 派大星
 * @date 2024-07-23
 */
@RestController
@RequestMapping("/archive/ArchiveBoxinnerMoveTask")
public class ArchiveBoxinnerMoveTaskController extends BaseController
{
    @Autowired
    private IArchiveBoxinnerMoveTaskService archiveBoxinnerMoveTaskService;

    /**
     * 查询盒间移位任务列表
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxinnerMoveTask:list')")
    @GetMapping("/list")
    public TableDataInfo list(ArchiveBoxinnerMoveTask archiveBoxinnerMoveTask)
    {
        startPage();
        List<ArchiveBoxinnerMoveTask> list = archiveBoxinnerMoveTaskService.selectArchiveBoxinnerMoveTaskList(archiveBoxinnerMoveTask);
        return getDataTable(list);
    }

    /**
     * 导出盒间移位任务列表
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxinnerMoveTask:export')")
    @Log(title = "盒间移位任务", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ArchiveBoxinnerMoveTask archiveBoxinnerMoveTask)
    {
        List<ArchiveBoxinnerMoveTask> list = archiveBoxinnerMoveTaskService.selectArchiveBoxinnerMoveTaskList(archiveBoxinnerMoveTask);
        ExcelUtil<ArchiveBoxinnerMoveTask> util = new ExcelUtil<ArchiveBoxinnerMoveTask>(ArchiveBoxinnerMoveTask.class);
        util.exportExcel(response, list, "盒间移位任务数据");
    }

    /**
     * 获取盒间移位任务详细信息
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxinnerMoveTask:query')")
    @GetMapping(value = "/{taskId}")
    public AjaxResult getInfo(@PathVariable("taskId") String taskId)
    {
        return AjaxResult.success(archiveBoxinnerMoveTaskService.selectArchiveBoxinnerMoveTaskByTaskId(taskId));
    }

    /**
     * 新增盒间移位任务
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxinnerMoveTask:add')")
    @Log(title = "盒间移位任务", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ArchiveBoxinnerMoveTask archiveBoxinnerMoveTask)
    {
        archiveBoxinnerMoveTask.setTaskId(UUID.randomUUID().toString());
        return toAjax(archiveBoxinnerMoveTaskService.insertArchiveBoxinnerMoveTask(archiveBoxinnerMoveTask));
    }

    /**
     * 修改盒间移位任务
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxinnerMoveTask:edit')")
    @Log(title = "盒间移位任务", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ArchiveBoxinnerMoveTask archiveBoxinnerMoveTask)
    {
        return toAjax(archiveBoxinnerMoveTaskService.updateArchiveBoxinnerMoveTask(archiveBoxinnerMoveTask));
    }

    /**
     * 删除盒间移位任务
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxinnerMoveTask:remove')")
    @Log(title = "盒间移位任务", businessType = BusinessType.DELETE)
	@DeleteMapping("/{taskIds}")
    public AjaxResult remove(@PathVariable String[] taskIds)
    {
        return toAjax(archiveBoxinnerMoveTaskService.deleteArchiveBoxinnerMoveTaskByTaskIds(taskIds));
    }

    /**
     * 修改盒间移位状态
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxinnerMoveTask:updateArchiveBoxinnerMoveTaskStatus')")
    @Log(title = "修改盒间移位状态", businessType = BusinessType.UPDATE)
    @PostMapping("/updateArchiveBoxinnerMoveTaskStatus")
    public AjaxResult updateArchiveBoxinnerMoveTaskStatus(@RequestBody ArchiveBoxinnerMoveTask archiveBoxinnerMoveTask)
    {
        return AjaxResult.success(archiveBoxinnerMoveTaskService.updateArchiveBoxinnerMoveTaskStatus(archiveBoxinnerMoveTask));
    }
}
